package com.boarsoft.boar.office.work.biz;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.boarsoft.boar.office.entity.OfficeWorkInfo;
import com.boarsoft.boar.office.entity.OfficeWorkLog;
import com.boarsoft.boar.office.work.OfficeWorkLogBiz;
import com.boarsoft.common.dao.PagedResult;
import com.boarsoft.hibernate.biz.SimpleBizImpl;

@Component
public class OfficeWorkLogBizImpl extends SimpleBizImpl implements OfficeWorkLogBiz {
	@Override
	@Transactional(readOnly = true)
	public List<OfficeWorkLog> list(String workId, String userId) {
		StringBuilder sb = new StringBuilder();
		sb.append(" and cWorkId='").append(workId).append("'");
		sb.append(" and cUserId='").append(userId).append("'");
		return dao.list(OfficeWorkLog.class, sb.toString());
	}

	@Override
	@Transactional
	public void add(OfficeWorkLog o) {
		dao.save(o);
	}

	@Override
	@Transactional
	public void update(OfficeWorkLog o) {
		dao.merge(o);
	}

	@Override
	@Transactional(readOnly = true)
	public PagedResult<OfficeWorkInfo> list(String taskId, String userId, String date, String key, String orderBy, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	@Transactional(readOnly = true)
	public OfficeWorkLog get(String id) {
		return dao.get(OfficeWorkLog.class, id);
	}
}
